package gui.commands;

import model.entity.Item;
import model.entity.container.ProductContainer;
import model.management.ItemManager;
import common.Result;

public class MoveItemCommand implements Command
{
  private final Item             item;
  private final ProductContainer from;
  private final ProductContainer target;

  public MoveItemCommand(Item item, ProductContainer target)
  {
    this.item = item;
    this.from = item.getContainer();
    this.target = target;
  }

  @Override
  public Result reverse()
  {
    return ItemManager.moveItemToStorageUnit(item, from);
  }

  @Override
  public Result execute()
  {
    return ItemManager.moveItemToStorageUnit(item, target);
  }

}
